<?php 
global $_GPC, $_W;
$GLOBALS['frames'] = $this->getMainMenu();
// $cates = pdo_getall('snx_class',array('id'=>$_GPC['class_id'],'uniacid'=>$_W['uniacid']));
$info = pdo_get('snx_users',array('id'=>$_GPC['id']));
// var_dump($cates);die;
if(checksubmit('submit')){
        $data['students_name']=$_GPC['students_name'];
        $data['parents_name']=$_GPC['parents_name'];
        $data['class_id']=$_GPC['class_id'];
        $data['phone_number']=$_GPC['phone_number'];
        $data['uniacid']=$_W['uniacid'];
       if(empty($_GPC['class_id'])){
          message('班级不能为空','','error');
       }if (empty($_GPC['students_name'])) {
          message('学生姓名不能为空','','error');
       }if(empty($_GPC['parents_name'])){
          message('家长姓名不能为空','','error');
       }if(empty($_GPC['phone_number'])){
          message('联系电话为空','','error');
       }
        $res = pdo_get('snx_users',array('class_id'=>$_GPC['class_id'],'phone_number'=>$_GPC['phone_number'],'uniacid'=>$_W['uniacid']),array('class_id'));
        if ($res) {
            message('不能和原班级相同','','error');
        }
         if($_GPC['id']){  
           $rst=pdo_update('snx_users',$data,array('id'=>$_GPC['id']));
            if($rst){
                 message('编辑成功！', $this->createWebUrl('user'), 'success');
            }else{
                 message('编辑失败！','','error');
            }
        }else{
             
        }
}
include $this->template('web/editorusers');
 ?>